<script setup>
// 引入 api
import { ref } from "vue"

// 列表
const list = ref(
    [
        { group: 'A', name: '张三' },
        { group: 'B', name: '李四' },
        { group: 'A', name: '王五' }
    ]
)
</script>

<template>
    <!-- 渲染 -->
    <!-- A -->
    <p>A</p>
    <ul v-for="(item, index) in list" key="index">
        <li v-if="item.group === 'A'">
            {{ item.name }}
        </li>
    </ul>
    <!-- B -->
    <p>B</p>
    <ul v-for="(item, index) in list" key="index">
        <li v-if="item.group === 'B'">
            {{ item.name }}
        </li>
    </ul>
</template>